/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"16F77714-F7BA-4D8A-9BC5-69FDB75CB966"}
 */
function cancelar(event) {
	databaseManager.rollbackEditedRecords()
	databaseManager.setAutoSave(true)
	globals.CerrarForm('turno_dlg')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"2B95535B-4F1A-4A79-90F8-9561517E3E56"}
 */
function aceptar(event) {
	if(databaseManager.saveData())
	{	
		databaseManager.setAutoSave(true)
		globals.CerrarForm('turno_dlg')
		forms['calendario'].condicion = 'ocupado'
		forms['calendario'].paciente = turnos_to_pacientes.nombre
		forms['calendario'].atendido = atencion
		forms['calendario'].presente = presencia
		forms['calendario'].pacienteid = paciente_id
		forms['calendario'].turnoid = turnos_id
		globals.gDialog('Exito','Turno dado de alta exitosamente','OK','CerrarForm')
	}
	else
	{
		globals.CerrarForm('turno_dlg')
		globals.gDialog('Error','La operacion no se pudo completar','OK','CerrarForm')
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"86871272-6754-471B-B87A-3404D9AEFF04"}
 */
function mostrarListaPacientes(event) {
	application.showFormInDialog(forms.turnos_pacientes_tbl,-1,-1,-1,300,'LISTA DE PACIENTES',true,false,'PACIENTES',true)
}
